package com.kiven.quicksort;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.Arrays;
import java.util.TreeMap;

public class TestByKiven {
	private int[] params;
	
	public int[] paramsFactory() {
		Random random = new Random();
		params = new int[10];
		for(int i=0; i<10; i++) {
			params[i] = random.nextInt(100);
		}
		return params;
	}
	
	public void changeName(Person person) {
		person.setAge(10);
		person.setName("kiven");
	}
	
	public static void main(String[] args) {
		/*int[] recourceNums = new TestByKiven().paramsFactory();
		int index=0;
		while(true) {
			while(++index < 10) {}
			if(index == 10)
			System.out.println(recourceNums.length);
		}*/
		/*	
		for(int i=0; i<10; i++) {
			if(i == 5) {
				System.out.println("现在的i值已经是5了。。");
				return;
			}
			System.out.println("不知道这句还能不能继续执行");
		}*/
		
		/*Map<Integer,String> map = new HashMap<Integer,String>();
		StringBuffer sb = new StringBuffer();
		for(int i=0; i<10; i++) {
			map.put(i, sb.append("K" + i).toString());
		}
		
		//如何打印一个map
		
		Set keyset = map.keySet();
		Iterator iter = keyset.iterator();
		while(iter.hasNext()) {
			System.out.println(map.get(iter.next()));
		}*/
		
		
		/*获得键值对
		 * Set set = map.entrySet();
		Iterator iter = set.iterator();
		while(iter.hasNext()) {
			System.out.println(iter.next());
		}*/
		
		System.out.println(new String("A").hashCode() > new String("kiven").hashCode());
		System.out.println(new Integer(1).hashCode() == new Integer(1).hashCode());
		
		/*Scanner scanner = new Scanner(System.in);
		if(scanner.hasNextInt()) {
			System.out.println(scanner.nextInt());
		}*/
		
		/*
		 * 未实现的
		 * 
		 * Map<Object,Object> map = new HashMap();
		map.put("kiven", "liqingwen");
		map.put(1, 12);
		map.put(1.2, "ABC");
		map.put("F", "object");
		
		Set<Object> keyset = map.keySet();
		Object[] arrays = keyset.toArray();
		
		for(int i=0; i<keyset.size(); i++) {
			for(int j=i+1;i<keyset.size();j++) {
				if(arrays[i]>arrays[j]) {
					
				}
			}
		}*/
	/*	
		Map<Object,Object> map = new TreeMap<Object,Object>(new MyCamparator());
		map.put("First", "2");
		map.put("second", "kiven");
		map.put(1, 22);
		map.put(2, "li");
		map.put("A","qingwen");
		
		Set<Map.Entry<Object, Object>> entry = map.entrySet();
		Iterator iter = entry.iterator();
		while(iter.hasNext()) {
			//Map.Entry<Object, Object> map = iter.next();
			System.out.println(iter.next());
		}*/
		
		/*Person person = new Person("li",1000);
		System.out.println("未改前Person：" + person);
		new TestByKiven().changeName(person);
		System.out.println("改变后Person：" + person);*/
		
	}
}

class Person {
	private String name;
	private int age;
	public Person(String name,int age) {
		this.name = name;
		this.age = age;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String toString() {
		return "name:" + name + "age:" + age;
	}
}

class MyCamparator implements Comparator {

	@Override
	public int compare(Object arg0, Object arg1) {
		return arg0.hashCode() - arg1.hashCode();
	}
	
}
